{extend name="layout/base"}

{block name="content"}
<table id="table" lay-filter="filter"></table>
<script type="text/html" id="indexTpl">
  {{d.LAY_TABLE_INDEX+1}}
</script>
<script type="text/html" id="show">
    <a lay-event="edit"><span class="layui-btn layui-btn-sm layui-btn-radius layui-btn-normal">审核</span></a>
</script>
<script type="text/html" id="statusTpl">
        {{# switch(d.status) {
        case -1: }}
        <span class="layui-btn layui-btn-danger layui-btn-xs">待审核</span>
        {{# break;
        case 2: }}
        <span class="layui-btn layui-btn-checked layui-btn-xs">开通</span>
        {{# break;
        case 3: }}
        <span class="layui-btn layui-btn layui-btn-xs">打烊</span>
        {{# break;
        case 4: }}
        <span class="layui-btn layui-btn-normal layui-btn-xs">冻结</span>
        {{# break;
        case 5: }}
        <span class="layui-btn layui-btn-normal layui-btn-xs">永久关门</span>
        {{# break;
        default: }}
        未知
        {{# break;
        } }}
</script>
<script src="/static/layui/layui.js" charset="utf-8"></script>
<script>
layui.use(['jquery','table','form','layer'], function(){
    var $ = layui.jquery,
        table = layui.table
        form = layui.form
        layer = layui.layer;
    //渲染
    var monylist = table.render({
        elem: '#table',
        url: 'approval',
        page: true,
        cols: [[
            {title: '序号', templet: '#indexTpl'},
            {field: 'mername', title: '商户名'},
            {field: 'mobile', title: '手机号'},
            {field: 'status', title: '状态', templet: '#statusTpl'},
            {field: 'retime', title: '注册时间',templet:"<div>{{layui.util.toDateString(d.retime*1000,'yyyy-MM-dd HH:mm:ss')}}</div>"},
            {field: 'retime', title: '操作',templet:'#show'}
        ]],
    });
    table.on('tool(filter)', function(obj){ 
        var data = obj.data; //获得当前行数据
        var layEvent = obj.event;       
        if(layEvent == 'edit'){ //编辑
            layer.open({
                type: 2,
                title: '编辑',
                skin: 'layui-layer-rim', 
                content: '/manager/merchant/show/merid/?merid='+data.merid,
                area: ['100%','100%']
            }); 
        }
    });
});
</script>
{/block}
